.SUFFIXES: .c .o
CLNT = bin/client
SRVR = bin/server
CFLAGS =  -g -Wall -I/usr/include/mysql -Iinclude -DNDEBUG
CSFLAGS = -L/usr/lib64/mysql -lmysqlclient -lz -lm -lrt
CCFLAGS = -lrt
VPATH=src

SRVR_OBJ = server_main.o server.o data_base_xdr.o data_base_svc.o data_base_svc_proc.o chronometer.o
CLNT_OBJ = client.o data_base_xdr.o data_base_clnt.o chronometer.o

%.o: %.c
	gcc -c -o $@ $(CFLAGS) $<

default: $(CLNT) $(SRVR)

$(CLNT): $(CLNT_OBJ) 
	gcc $(CCFLAGS) -g -o $(CLNT) $(CLNT_OBJ)

$(SRVR): $(SRVR_OBJ)
	gcc $(CSFLAGS) -g -o $(SRVR) $(SRVR_OBJ)

latex/make:
	doxygen doxygen_file
doc: latex/make
	make -C doc/latex pdf
	cp doc/latex/*.pdf ./doc.pdf

clean:
	rm *.o $(CLNT) $(SRVR) *.pdf
	rm -rf doc/*
